const router = require("express").Router();
const mysql = require("../mysql");
const Search = require("../mysql/collection/Search");
const uuid = require("uuid");

/**
 * @swagger
 * /admin/search/list:
 *   get:
 *     summary: 搜索关键词列表
 *     tags: [管理端]
 *     security:
 *       - bearerAuth: []
 *     responses:
 *       200:
 *         description: 获取搜索关键词列表成功
 *         content:
 *           application/json:
 *             schema:
 *               type: object
 *               properties:
 *                 code:
 *                   type: string
 *                   example: '200'
 *                 message:
 *                   type: string
 *                   example: '搜索关键词列表'
 *                 data:
 *                   type: array
 *                   description: 搜索关键词数据
 */
router.get("/list", (req, res, next) => {
  mysql.find(Search, {}, { _id: 0, __v: 0 }).then((data) => {
    // res.send(data)

    res.send({
      code: "200",
      message: "搜索关键词列表",
      data,
    });
  });
});

module.exports = router;

